/* SVConnector.m
 * Written By:  Thomas Burkholder
 *
 * You may freely copy, distribute, and reuse the code in this example.
 * NeXT disclaims any warranty of any kind, expressed or  implied, as to its
 * fitness for any particular use.
 */

// name space protected for WavesWorld by the addition of the "WWTT" prefix

#import "WWTTSVConnector.h"
#import "WWTTSwitchView.h"

@implementation WWTTSVConnector

- setSource:anObject
{
	source = anObject;
	return self;
}

- source
{
	return source;
}

- setDestination:anObject
{
	destination = anObject;
	return self;
}

- destination
{
	return destination;
}

- establishConnection
{
	return self;
}

- nibInstantiate
{
	// by experimentation, we know IB calls the connectors in the reverse
	// order that the connections were added to the document.

	[[source views] insertObject:destination at:0];
	return self;
}

- renewObject:old to:new
{
	if (old == source)
		source = new;
	else if (old == destination)
		destination = new;
	return self;
}

- read:(NXTypedStream *)stream
{
	[super read:stream];
	source = NXReadObject(stream);
	destination = NXReadObject(stream);
	return self;
}

- write:(NXTypedStream *)stream
{
	[super write:stream];
	NXWriteObject(stream, source);
	NXWriteObject(stream, destination);
	return self;
}

- free
{
	return [super free];
}

@end
